/*
 *  Copyright 2010 dmakariev.
 * 
 */
package org.deltaset.faces.upload;

import java.util.Enumeration;
import java.util.List;
import java.util.Map;

/**
 *
 * @author dmakariev
 */
public final class FileRequestHolder {

    private static ThreadLocal<FileRequest> threadLocal = new ThreadLocal<FileRequest>() {

        @Override
        protected FileRequest initialValue() {
            return new FileRequest();
        }
    };

    public static boolean isEmpty() {
        return threadLocal.get().isEmpty();
    }

    static void setFileRequest(FileRequest fileRequest) {
        threadLocal.set(fileRequest);
    }

    public static Map<String, List<DsFileItem>> getFileParameterMap() {
        return threadLocal.get().getFileParameterMap();
    }

    public static Enumeration<String> getFileParameterNames() {
        return threadLocal.get().getFileParameterNames();
    }

    public static List<DsFileItem> getFileParameterValues(String name) {
        return threadLocal.get().getFileParameterValues(name);
    }

    public static DsFileItem getFileParameter(String name) {
        return threadLocal.get().getFileParameter(name);
    }
}
